#include "mainwindow.h"
#include "view_desktopui.h"
#include "view_autoui.h"
#include "view_infoui.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
{
    stackedAPPWidget = new QStackedWidget(this);
    setCentralWidget(stackedAPPWidget);
    stackedAPPWidget->setFixedSize(1024, 600);

    View_DesktopUI *UI_Desktop = new View_DesktopUI();
    View_AutoUI *UI_Auto = new View_AutoUI();
    View_InfoUI *UI_Info = new View_InfoUI();

    stackedAPPWidget->addWidget(UI_Desktop);
    stackedAPPWidget->addWidget(UI_Auto);
    stackedAPPWidget->addWidget(UI_Info);

    connect(UI_Desktop, &View_DesktopUI::switchToViewAuto, [=]() {
        stackedAPPWidget->setCurrentWidget(UI_Auto);
    });

    connect(UI_Desktop, &View_DesktopUI::switchToViewInfo, [=]() {
        stackedAPPWidget->setCurrentWidget(UI_Info);
    });
    
    connect(UI_Auto, &View_AutoUI::AutoswitchToDesktop, [=]() {
        stackedAPPWidget->setCurrentWidget(UI_Desktop);
    });

    connect(UI_Info, &View_InfoUI::InfoswitchToDesktop, [=]() {
        stackedAPPWidget->setCurrentWidget(UI_Desktop);
    });

}

MainWindow::~MainWindow()
{
}

